"""
model name : 深度学习
file       : optimizer.py
information:
    author : OuYang
    time   : 2025/1/18
"""

import torch


def select_optimizer(optim_name, model_parameters, **kwargs):
    if optim_name == 'SGD':
        return torch.optim.SGD(
            params=model_parameters,
            lr=kwargs['lr'],
            momentum=kwargs['momentum'],
            weight_decay=kwargs['weight_decay']
        )
    elif optim_name == 'Adam':
        return torch.optim.Adam(
            params=model_parameters,
            lr=kwargs['lr'],
            weight_decay=kwargs['weight_decay']
        )
